<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <title>测试分享接口</title>
</head>
<body>
<h6>测试分享接口</h6>

<form id="testFrom" method="post" action="/transfers">
    <input  name="nonceStr" type="hidden" th:value="${nonceStr}">
    <input  name="jsapi_ticket" type="hidden" th:value="${jsapi_ticket}">
    <input  name="timestamp" type="hidden" th:value="${timestamp}">
    <input  name="signature" type="hidden" th:value="${signature}">
</form>

</body>
<script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script src="/js/jquery-1.9.1.js"></script>
<script>
    let nonceStr = $("#nonceStr").val();
    let jsapi_ticket = $("#jsapi_ticket").val();
    let timestamp = $("#timestamp").val();
    let signature = $("#signature").val();
    let appId = $("#appId").val();
    wx.config({
        debug: false,
        appId: appId,
        timestamp: timestamp,
        nonceStr: nonceStr,
        signature: signature,
        jsApiList : [ 'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareWeibo',
            'onMenuShareQZone',
            'startRecord',
            'stopRecord',
            'onVoiceRecordEnd',
            'playVoice',
            'pauseVoice',
            'stopVoice',
            'onVoicePlayEnd',
            'uploadVoice',
            'downloadVoice',
            'chooseImage',
            'previewImage',
            'uploadImage',
            'downloadImage',
            'translateVoice',
            'getNetworkType',
            'openLocation',
            'getLocation',
            'hideOptionMenu',
            'showOptionMenu',
            'hideMenuItems',
            'showMenuItems',
            'hideAllNonBaseMenuItem',
            'showAllNonBaseMenuItem',
            'closeWindow',
            'scanQRCode',
            'chooseWXPay',
            'openProductSpecificView',
            'addCard',
            'chooseCard',
            'openCard' ]  // 必填，需要使用的JS接口列表
    });//end_config

    wx.error(function(res) {
        console.log("error")
        alert("出错了：" + res.errMsg);
    });

    wx.ready(function() {
        wx.checkJsApi({
            jsApiList: ['scanQRCode'],
            success: function (res) {
                console.log("success")
                alert("验证成功" + res);

                // 以键值对的形式返回，可用的api值true，不可用为false
                // 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
            }
        });
    });
</script>
</html>